<?php
namespace Admin\Controller;
use Admin\Controller\BaseController;
class LoginController extends BaseController {
	public function _initialize(){
		//parent::_initialize();
	}
	public function login(){
		$this->display();
	}
	public function dologin(){
		$map=array(
			"yjl_adminname"=>I('post.adminname'),
			"yjl_password"=>md5(I('post.password'))
		);
		//var_dump($map);
		$admin=M("admins")->where($map)->find();
		//var_dump($admin);
		if($admin){
			session('admin',$admin);
			
			//echo "dsd";
			$this->redirect("Users/index");
		}else{
			$this->redirect('Login/login');
		}
	}
	public function logout(){
		session('admin',null);
		$this->redirect('Login/login');
	}
}
?>